﻿<UserControl x:Class="Ops.Mpc.ExampleApplication.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:presenters="clr-namespace:Ops.Mpc.Presenters;assembly=Ops.Mpc"
    xmlns:controllers="clr-namespace:Ops.Mpc.Controllers;assembly=Ops.Mpc"   
    xmlns:models="clr-namespace:Ops.Mpc.Models;assembly=Ops.Mpc"         
    xmlns:states="clr-namespace:Ops.Mpc.States;assembly=Ops.Mpc"   
    xmlns:simplebindings="clr-namespace:Ops.Mpc.ExampleApplication.SimpleBindings"   
    xmlns:navigations="clr-namespace:Ops.Mpc.ExampleApplication.Navigations"
    xmlns:datatemplatebindings="clr-namespace:Ops.Mpc.ExampleApplication.DataTemplateBindings" 
    xmlns:datapaging="clr-namespace:Ops.Mpc.ExampleApplication.DataPaging" 
    xmlns:polling="clr-namespace:Ops.Mpc.ExampleApplication.Polling"         
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:Ops.Mpc.ExampleApplication" 
    xmlns:localmodels="clr-namespace:Ops.Mpc.ExampleApplication.Models"     
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"     
    xmlns:actions="clr-namespace:Ops.Mpc.ExampleApplication.Actions"         
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" FontSize="18">
    <Grid >
        <Grid.Background>
            <ImageBrush ImageSource="/Ops.Mpc.ExampleApplication;component/Images/Abstract Shards.jpg" />
        </Grid.Background>

        <Grid Height="800" Width="900" HorizontalAlignment="Center" VerticalAlignment="Center">

            <presenters:Presenter x:Name="MainPressenter" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <controllers:Controller>
                    <controllers:Controller.StateTransitions>
                        <states:StateTransition From="MainState" To="*" Transition="SwivelRight"/>
                        <states:StateTransition From="*" To="MainState" Transition="SwivelLeft"/>
                    </controllers:Controller.StateTransitions>
                    <controllers:Controller.Models>
                        <localmodels:MessageModel ItemName="MessageModel" />
                        <models:BusyIndicatorModel ItemName="BusyIndicatorModel" />
                    </controllers:Controller.Models>
                    <controllers:Controller.States>
                        <states:State ItemName="MainState" AutoRun="True">
                            <states:StateTemplate>
                                <Grid Margin="20">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="50"/>
                                        <RowDefinition Height="10"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto" />
                                        <ColumnDefinition Width="10"/>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Border Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" Background="White" BorderBrush="Black" BorderThickness=".5" CornerRadius="5"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
                                        <Border.Effect>
                                            <DropShadowEffect />
                                        </Border.Effect>
                                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0" Text="{Binding Models[MessageModel].MainMessage}" Foreground="Blue"/>
                                    </Border>
                                    <Border Grid.Column="0" Grid.Row="2" Background="White" BorderBrush="Black" BorderThickness=".5" CornerRadius="5"  Padding="20" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"  >
                                        <Border.Effect>
                                            <DropShadowEffect />
                                        </Border.Effect>
                                        <navigations:NavigationControl />
                                    </Border>
                                    <Border Grid.Column="2" Grid.Row="2" Background="White" BorderBrush="Black" BorderThickness=".5" CornerRadius="5"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                                        <Border.Effect>
                                            <DropShadowEffect />
                                        </Border.Effect>
                                        <toolkit:BusyIndicator IsBusy="{Binding Models[BusyIndicatorModel].IsBusy}" BusyContent="{Binding Models[BusyIndicatorModel].BusyMessage}" >
                                            <navigations:NavigationTargetControl />
                                        </toolkit:BusyIndicator>
                                    </Border>
                                 </Grid>
                            </states:StateTemplate>
                            <states:State.StateActions>
                                <actions:SetMainMessageStateAction ItemName="SetMainMessageStateAction" MessageId="MainMessage" />
                                <states:ChildPresenterStateAction ChildPresenterName="NavigationTargetPresenter" ItemName="SimpleBindingsStateAction" NextStateItemName="SimpleBindingsState" />
                                <states:ChildPresenterStateAction ChildPresenterName="NavigationTargetPresenter" ItemName="DataTemplateBindingsStateAction" NextStateItemName="DataTemplateBindingsState" />
                                <states:ChildPresenterStateAction ChildPresenterName="NavigationTargetPresenter" ItemName="DataPagingStateAction" NextStateItemName="DataPagingState" />
                                <states:ChildPresenterStateAction ChildPresenterName="NavigationTargetPresenter" ItemName="PollingStateAction" NextStateItemName="PollingState" />
                            </states:State.StateActions>
                        </states:State>
                    </controllers:Controller.States>
                </controllers:Controller>
            </presenters:Presenter>            
        </Grid>
    </Grid>
</UserControl>
